package com.atguigu.springcloud.service;

import com.atguigu.springcloud.entity.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * openFeign  的编码和调用规则：
 * 1、启动项激活openfeign功能，@EnableFeignClients,
 * 2、调用的地方需要加上FeginClient注解，和调用服务的名称，调用的方法不可以写错，保持和服务端的方法一致。
 * # 设置openfeign客户端超时时间，OpenFeign默认支持Ribbon
 * ribbon:
 *   ReadTimeout: 5000
 *   ConnectTimeout: 5000
 */
@Service
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface OrderFeignService {

    @GetMapping("/payment/get/{id}")
    public CommonResult getPayment(@PathVariable("id") Long id);

    @GetMapping("/payment/feign/timeout")
    public String paymentFeignTimeout();
}
